package com.example.demo.service.impl;

import com.example.demo.entity.RoleEntity;
import com.example.demo.mapper.RoleMapper;
import com.example.demo.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class RoleServiceImpl implements RoleService {

    // @Resource
    @Autowired
    private RoleMapper roleMapper;

    @Override
    public String getRoleName() {

        return "数据库查出来的姓名:" + roleMapper.getRoleName()  + "!!!";

    }

    @Override
    public int addRole(RoleEntity role) {

        // todo 其他业务处理
        int id = roleMapper.addRole(role);

        return role.getRoleId();
    }

    @Override
    public RoleEntity getRoleById(int id) {
        return roleMapper.getRoleById(id);
    }
    @Override
    public int deleteRoleById(int id) {
        return roleMapper.deleteRoleById(id);
    }

    @Override
    public List<RoleEntity> list() {
        return roleMapper.rollList();
    }
}
